CREATE PROCEDURE [dbo].[InsertMessage]

@FromAddress	varchar(MAX),
@ToAddress	varchar(MAX),
@CCAddress	varchar(MAX),
@BCCAddress	varchar(MAX),
@Subject	varchar(MAX),
@Body	nvarchar(MAX),
@IsBodyHTML	bit,
@MessageID int out

AS

INSERT INTO Message
(FromAddress, ToAddress, CCAddress,BCCAddress,[Subject],Body,IsBodyHTML, QueueStateID)
VALUES
(@FromAddress, @ToAddress, @CCAddress,@BCCAddress,@Subject,@Body,@IsBodyHTML, 1)

SET @MessageID = SCOPE_IDENTITY()

GO